import java.util.Scanner;

public class day230510 {
    // 字符串计数
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s1 = sc.next();
            String s2 = sc.next();
            int len1 = sc.nextInt();
            int len2 = sc.nextInt();
            // 1. 对长度不够的进行字符串填充
            while (s1.length() < s2.length()) {
                s1 += "a";
            }
            while (s2.length() < s1.length()){
                s2 += "{";
            }
            // 2. 记录每一位上的差值
            int[] arr = new int[len2];
            for (int i = 0; i < len2; i++) {
                arr[i] = s2.charAt(i) - s1.charAt(i);
            }
            // 3. 分长度计算, 不同长度下的个数相加
            int result = 0;
            for (int i = len1; i <= len2; i++) {
                for (int j = 0; j < i; j++) {
                    result += arr[j] * Math.pow(26, i - j - 1);
                }
            }
            result -= 1;
            result %= 1000007;
            System.out.println(result);
        }
    }

    // 最长公共子序列
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            String s1 = " " + in.next();
            String s2 = " " + in.next();
            int n = s1.length();
            int m = s2.length();
            int[][] dp = new int[n][m];
            for (int i = 1; i < n; i++) {
                for (int j = 1; j < m; j++) {
                    if (s1.charAt(i) == s2.charAt(j)) {
                        dp[i][j] = dp[i - 1][j - 1] + 1;
                    } else {
                        dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                    }
                }
            }
            System.out.println(dp[n - 1][m - 1]);
        }
    }
}
